Xbasic

WAITDIALOG.ALLOWCANCEL Function

Syntax

AllowCancel as V(flag as L)

Arguments

flag

.T. = Turns the Cancel button on, .F. = Turns the Cancel button off.

Description

The .ALLOWCANCEL() method enables or disables the Cancel button on a Wait Dialog. The Cancel button closes the Wait Dialog.

Example

This example shows how you can allow the user to break out of a loop by using the waitdialog's AllowCancel feature. Note that the loop includes the ui_yield() function. This function allows the user interface to be response even while the code loops.

dim colors as C
dim x as waitdialog
dim i as N 
 dim count as N
colors = a5.Color_Enum() 
 x.Create(3,"percent") 
 x.AllowCancel(.t.) 

 i = 0 
 count = line_count(colors) 
 for each c in colors 
     ui_yield()
     i = i + 1 
     x.set_percent(i,count) 
     x.set_bottom_message(c.value) 
     y = x.user_canceled() 
     if x.user_canceled()then 
         q = ui_msg_box("Notice","Are you sure?",UI_YES_NO_CANCEL) 
         if q = ui_yes_selected then 
             goto next2 
         else 
             x.Cancel_Cancel() 
         end if 
     end if 
 next 
 next2: 
 x.close()

Limitations

Desktop applications only.

See Also